bitkeeper revision 1.809 (4059b6abq9zvnfmJ9cVcMhBo_lOhew)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Thu, 18 Mar 2004 14:48:11 +0000 (14:48 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Thu, 18 Mar 2004 14:48:11 +0000 (14:48 +0000)
Many files:
  Scheduler updates.
sched_ctl.h:
  Rename: xen/include/hypervisor-ifs/sched-ctl.h -> xen/include/hypervisor-ifs/sched_ctl.h

15 files changed:
.rootkeys
tools/xc/lib/xc_atropos.c
tools/xc/lib/xc_bvtsched.c
tools/xc/lib/xc_private.h
tools/xc/lib/xc_rrobin.c
tools/xc/py/Makefile
tools/xenctl/Makefile
tools/xenctl/lib/console_client.py
tools/xend/Makefile
xen/common/dom0_ops.c
xen/common/sched_rrobin.c
xen/common/schedule.c
xen/include/hypervisor-ifs/dom0_ops.h
xen/include/hypervisor-ifs/sched-ctl.h [deleted file]
xen/include/hypervisor-ifs/sched_ctl.h [new file with mode: 0644]

index d302f373295466e887a06600ec484b91b5ae9201..e1a72ba5038db416bc0fdcc61755048f20de48c1 100644 (file)
--- a/.rootkeys
+++ b/.rootkeys
 3ead095dE_VF-QA88rl_5cWYRWtRVQ xen/include/hypervisor-ifs/kbd.h
 3ddb79c2oRPrzClk3zbTkRHlpumzKA xen/include/hypervisor-ifs/network.h
 4051db79512nOCGweabrFWO2M2h5ng xen/include/hypervisor-ifs/physdev.h
-40589968wmhPmV5-ENbBYmMjnedgKw xen/include/hypervisor-ifs/sched-ctl.h
+40589968wmhPmV5-ENbBYmMjnedgKw xen/include/hypervisor-ifs/sched_ctl.h
 404f3d2eR2Owk-ZcGOx9ULGHg3nrww xen/include/hypervisor-ifs/trace.h
 3f0d22cbroqp_BkoDPwkfRJhaw1LiQ xen/include/hypervisor-ifs/vbd.h
 3ddb79c4qbCoOFHrv9sCGshbWzBVlQ xen/include/scsi/scsi.h
index b9ee719b0fe7ffe7ba0d9f1f8866361e8fcebbcd..06ba01cf32ea2b3fbad19088cc73de35f17be229 100644 (file)
@@ -12,11 +12,12 @@ int xc_atropos_global_set(int xc_handle,
                          unsigned long ctx_allow)
 {
     dom0_op_t op;
+
     op.cmd = DOM0_SCHEDCTL;
-    op.u.schedctl.if_ver = SCHED_CTL_IF_VER;
     op.u.schedctl.sched_id = SCHED_BVT;
 
     op.u.schedctl.u.bvt.ctx_allow = ctx_allow;
+
     return do_dom0_op(xc_handle, &op);
 }
 
@@ -24,15 +25,12 @@ int xc_atropos_domain_set(int xc_handle,
                          u64 domid, int xtratime)
 {
     dom0_op_t op;
-    op.cmd = DOM0_ADJUSTDOM;
 
+    op.cmd = DOM0_ADJUSTDOM;
     op.u.adjustdom.domain  = (domid_t)domid;
-    op.u.adjustdom.if_ver = SCHED_CTL_IF_VER;
     op.u.adjustdom.sched_id = SCHED_ATROPOS;
 
     op.u.adjustdom.u.atropos.xtratime = xtratime;
 
-    printf("Doing dom0 op!\n");
-
     return do_dom0_op(xc_handle, &op);
 }
index e38f9cf09ed74833db68af77980146b309519bc3..428c2d6c32d6945b7124466b407464f5b44a69ac 100644 (file)
@@ -12,10 +12,12 @@ int xc_bvtsched_global_set(int xc_handle,
                            unsigned long ctx_allow)
 {
     dom0_op_t op;
+
     op.cmd = DOM0_SCHEDCTL;
     op.u.schedctl.sched_id = SCHED_BVT;
-    op.u.schedctl.if_ver = SCHED_CTL_IF_VER;
+
     op.u.schedctl.u.bvt.ctx_allow = ctx_allow;
+
     return do_dom0_op(xc_handle, &op);
 }
 
@@ -27,16 +29,16 @@ int xc_bvtsched_domain_set(int xc_handle,
                            unsigned long warpu)
 {
     dom0_op_t op;
-    struct bvt_adjdom *adjptr = &op.u.adjustdom.u.bvt;
+    struct bvt_adjdom *bvtadj = &op.u.adjustdom.u.bvt;
 
     op.cmd = DOM0_ADJUSTDOM;
-    op.u.adjustdom.sched_id = SCHED_BVT;
-    op.u.adjustdom.if_ver   = SCHED_CTL_IF_VER;
     op.u.adjustdom.domain  = (domid_t)domid;
+    op.u.adjustdom.sched_id = SCHED_BVT;
+
+    bvtadj->mcu_adv = mcuadv;
+    bvtadj->warp    = warp;
+    bvtadj->warpl   = warpl;
+    bvtadj->warpu   = warpu;
 
-    adjptr->mcu_adv = mcuadv;
-    adjptr->warp    = warp;
-    adjptr->warpl   = warpl;
-    adjptr->warpu   = warpu;
     return do_dom0_op(xc_handle, &op);
 }
index 859d3a7740f2548116cc3868237457c3069437f8..8762790836af49167201e3773f52f50111b2f5b7 100644 (file)
@@ -23,7 +23,7 @@
 #include <dom0_ops.h>
 #include <vbd.h>
 #include <event_channel.h>
-#include <sched-ctl.h>
+#include <sched_ctl.h>
 
 #define _PAGE_PRESENT   0x001
 #define _PAGE_RW        0x002
index 4d986cee83586288f386281438b8f28362cdc6cb..c91550805047ac52383f25585c822926d3f2d0ec 100644 (file)
 int xc_rrobin_global_set(int xc_handle, u64 slice)
 {
     dom0_op_t op;
+
     op.cmd = DOM0_SCHEDCTL;
-    op.u.schedctl.if_ver = SCHED_CTL_IF_VER;
     op.u.schedctl.sched_id = SCHED_RROBIN;
 
     op.u.schedctl.u.rrobin.slice = slice;
+
     return do_dom0_op(xc_handle, &op);
 }
index e3583f5dd8a2e159e0a77113f43e7ccfec4593c5..6a4f34846dc0d81e4fd467592bf0bbb7c76967f2 100644 (file)
@@ -4,7 +4,7 @@ all:
 
 install: all
        if [ "$(prefix)" = "" ]; then python setup.py install; \
-       else python setup.py install --home="$(prefix)"; fi
+       else python setup.py install --root="$(prefix)"; fi
 
 clean:
        rm -rf build *.pyc *.pyo *.o *.a *~
index e3583f5dd8a2e159e0a77113f43e7ccfec4593c5..6a4f34846dc0d81e4fd467592bf0bbb7c76967f2 100644 (file)
@@ -4,7 +4,7 @@ all:
 
 install: all
        if [ "$(prefix)" = "" ]; then python setup.py install; \
-       else python setup.py install --home="$(prefix)"; fi
+       else python setup.py install --root="$(prefix)"; fi
 
 clean:
        rm -rf build *.pyc *.pyo *.o *.a *~
index df15d6f1d344d44c06d30f3ec7f5cd56c54ac6d4..84109dda96e4155033f9e4f9282c34b666a4235d 100644 (file)
@@ -72,4 +72,7 @@ def connect(host,port):
         __send_to_sock(sock)
 
 if __name__ == '__main__':
+    if len(sys.argv) != 3:
+        print sys.argv[0] + " <host> <port>"
+        sys.exit(1)
     connect(str(sys.argv[1]),int(sys.argv[2]))
index 93c0cfe1f75f0f83021bca5db6290b273315b518..944620d5ece900c0d7954884abb70e6e8c40f9f5 100644 (file)
@@ -4,7 +4,7 @@ all:
 
 install: all
        if [ "$(prefix)" = "" ]; then python setup.py install; \
-       else python setup.py install --home="$(prefix)"; fi
+       else python setup.py install --root="$(prefix)"; fi
        mkdir -p $(prefix)/usr/sbin
        install -m0755 xend $(prefix)/usr/sbin
 
index 1d69f35bf3a7060febef26977813df51f10e3506..8ff3139f800ad0643beeb03dd48a5d29fe32123a 100644 (file)
@@ -18,7 +18,7 @@
 #include <asm/pdb.h>
 #include <xeno/trace.h>
 #include <xeno/console.h>
-#include <hypervisor-ifs/sched-ctl.h>
+#include <hypervisor-ifs/sched_ctl.h>
 
 extern unsigned int alloc_new_dom_mem(struct task_struct *, unsigned int);
 
index ef4db600667e9ef26e0b98c4e43e0277a5079da2..e5eb2ecd1384bc1665605b6cdc09bb858591ddc1 100644 (file)
@@ -6,7 +6,7 @@
 
 #include <xeno/sched.h>
 #include <xeno/sched-if.h>
-#include <hypervisor-ifs/sched-ctl.h>
+#include <hypervisor-ifs/sched_ctl.h>
 #include <xeno/ac_timer.h>
 #include <xeno/time.h>
 
@@ -43,7 +43,7 @@ static void rr_dump_settings()
 }
 
 struct scheduler sched_rrobin_def = {
-    .name     = "Stupid Round Robin Scheduler",
+    .name     = "Round-Robin Scheduler",
     .opt_name = "rrobin",
     .sched_id = SCHED_RROBIN,
 
index 054123077c83c67fd6cdc566667cd945eeca6f59..9e5973f4a13250638d0ef0a734dbe3ccb974ab9d 100644 (file)
@@ -26,7 +26,7 @@
 #include <xeno/timer.h>
 #include <xeno/perfc.h>
 #include <xeno/sched-if.h>
-#include <hypervisor-ifs/sched-ctl.h>
+#include <hypervisor-ifs/sched_ctl.h>
 #include <xeno/trace.h>
 
 /*#define WAKEUP_HISTO*/
 
 #define TIME_SLOP      (s32)MICROSECS(50)     /* allow time to slip a bit */
 
-/* XXX MAW pull trace-related #defines out of here and into an auto-generated
- * header file later on! */
+/*
+ * XXX Pull trace-related #defines out of here and into an auto-generated
+ * header file later on!
+ */
 #define TRC_SCHED_DOM_ADD             0x00010000
 #define TRC_SCHED_DOM_REM             0x00010001
 #define TRC_SCHED_WAKE                0x00010002
@@ -66,26 +68,23 @@ static void t_timer_fn(unsigned long unused);
 static void dom_timer_fn(unsigned long data);
 static void fallback_timer_fn(unsigned long unused);
 
-/* this is global for now so that private implementations can reach it */
+/* This is global for now so that private implementations can reach it. */
 schedule_data_t schedule_data[NR_CPUS];
 
-/* XXX would be nice if the schedulers array could get populated
- * automagically without having to hack the code in here         */
+/*
+ * XXX It would be nice if the schedulers array could get populated
+ * automagically without having to hack the code in here.
+ */
 extern struct scheduler sched_bvt_def, sched_rrobin_def;
 static struct scheduler *schedulers[] = { &sched_bvt_def,
                                           &sched_rrobin_def,
                                           NULL};
 
-/* scheduler ops for the current scheduler */
+/* Operations for the current scheduler. */
 static struct scheduler ops;
 
-/* for scheduler functions that return void             */
-#define SCHED_FN_VOID(fn, ...) do { if ( ops.fn ) ops.fn(__VA_ARGS__); } \
-                               while (0)
-
-/* for scheduler functions that return a numeric value  */
-#define SCHED_FN_RET(fn, ...)                             \
-         (( ops.fn != NULL ) ? ops.fn( __VA_ARGS__ ) : 0 )
+#define SCHED_FN(fn, ...) \
+    ((ops.fn != NULL) ? (ops.fn(__VA_ARGS__)) : (typeof(ops.fn(__VA_ARGS__)))0)
 
 spinlock_t schedule_lock[NR_CPUS] __cacheline_aligned;
 
@@ -102,7 +101,7 @@ extern kmem_cache_t *task_struct_cachep;
 
 void free_task_struct(struct task_struct *p)
 {
-    SCHED_FN_VOID(free_task, p);
+    SCHED_FN(free_task, p);
     kmem_cache_free(task_struct_cachep, p);
 }
 
@@ -120,7 +119,7 @@ struct task_struct *alloc_task_struct(void)
 
     memset(p, 0, sizeof(*p));    
 
-    if ( SCHED_FN_RET(alloc_task, p) < 0)
+    if ( SCHED_FN(alloc_task, p) < 0)
     {
         kmem_cache_free(task_struct_cachep, p);
         return NULL;
@@ -134,7 +133,7 @@ struct task_struct *alloc_task_struct(void)
  */
 void sched_add_domain(struct task_struct *p) 
 {
-    p->state       = TASK_STOPPED;
+    p->state = TASK_STOPPED;
 
     if( p->domain != IDLE_DOMAIN_ID )
     {
@@ -149,14 +148,11 @@ void sched_add_domain(struct task_struct *p)
         schedule_data[p->processor].idle = p;
     }
 
-    SCHED_FN_VOID(add_task, p);
+    SCHED_FN(add_task, p);
 
     TRACE_3D(TRC_SCHED_DOM_ADD, _HIGH32(p->domain), _LOW32(p->domain), p);
 }
 
-/* XXX race condition here?   we could both add and remove a domain at once, in
- * theory.  ick! */
-/* XXX is the task already removed from the runlist at this point? */
 int sched_rem_domain(struct task_struct *p) 
 {
     int x, y = p->state;
@@ -166,7 +162,7 @@ int sched_rem_domain(struct task_struct *p)
 
     rem_ac_timer(&p->timer);
 
-    SCHED_FN_VOID(rem_task, p);
+    SCHED_FN(rem_task, p);
 
     TRACE_3D(TRC_SCHED_DOM_REM, _HIGH32(p->domain), _LOW32(p->domain), p);
 
@@ -179,9 +175,9 @@ void init_idle_task(void)
     unsigned long flags;
     struct task_struct *p = current;
 
-    if ( SCHED_FN_RET (alloc_task, p) < 0)
+    if ( SCHED_FN (alloc_task, p) < 0)
                panic("Failed to allocate scheduler private data for idle task");
-    SCHED_FN_VOID(add_task, p);
+    SCHED_FN(add_task, p);
 
     spin_lock_irqsave(&schedule_lock[p->processor], flags);
     p->has_cpu = 1;
@@ -202,7 +198,7 @@ void __wake_up(struct task_struct *p)
 
     p->state = TASK_RUNNING;
 
-    SCHED_FN_VOID(wake_up, p);
+    SCHED_FN(wake_up, p);
 
 #ifdef WAKEUP_HISTO
     p->wokenup = NOW();
@@ -319,13 +315,10 @@ long sched_ctl(struct sched_ctl_cmd *cmd)
 {
     TRACE_0D(TRC_SCHED_CTL);
 
-    if ( cmd->if_ver != SCHED_CTL_IF_VER )
-        return -EACCES;
-
     if ( cmd->sched_id != ops.sched_id )
         return -EINVAL;
 
-    return SCHED_FN_RET(control, cmd);
+    return SCHED_FN(control, cmd);
 }
 
 
@@ -334,9 +327,6 @@ long sched_adjdom(struct sched_adjdom_cmd *cmd)
 {
     struct task_struct *p;    
     
-    if ( cmd->if_ver != SCHED_CTL_IF_VER )
-        return -EACCES;
-
     if ( cmd->sched_id != ops.sched_id )
         return -EINVAL;
 
@@ -347,7 +337,7 @@ long sched_adjdom(struct sched_adjdom_cmd *cmd)
 
     TRACE_2D(TRC_SCHED_ADJDOM, _HIGH32(p->domain), _LOW32(p->domain));
 
-    SCHED_FN_VOID(adjdom, p, cmd);
+    SCHED_FN(adjdom, p, cmd);
 
     put_task_struct(p); 
     return 0;
@@ -388,7 +378,7 @@ unsigned long __reschedule(struct task_struct *p)
     if ( schedule_data[cpu].s_timer.expires > min_time + TIME_SLOP )
         mod_ac_timer(&schedule_data[cpu].s_timer, min_time);
 
-    return SCHED_FN_RET(reschedule, p);
+    return SCHED_FN(reschedule, p);
 }
 
 void reschedule(struct task_struct *p)
@@ -436,7 +426,7 @@ asmlinkage void __enter_scheduler(void)
         if ( signal_pending(prev) )
             prev->state = TASK_RUNNING;
         else
-            SCHED_FN_VOID(do_block, prev);
+            SCHED_FN(do_block, prev);
     }
 
     /* get policy-specific decision on scheduling... */
@@ -623,10 +613,10 @@ void __init scheduler_init(void)
     if ( ops.do_schedule == NULL)
         panic("Chosen scheduler has NULL do_schedule!");
 
-    if ( SCHED_FN_RET(init_scheduler) < 0 )
+    if ( SCHED_FN(init_scheduler) < 0 )
         panic("Initialising scheduler failed!");
 
-    SCHED_FN_VOID(add_task, &idle0_task);
+    SCHED_FN(add_task, &idle0_task);
 }
 
 /*
@@ -666,7 +656,7 @@ static void dump_rqueue(struct list_head *queue, char *name)
     list_for_each (list, queue) {
         p = list_entry(list, struct task_struct, run_list);
         printk("%3d: %llu has=%c ", loop++, p->domain, p->has_cpu ? 'T':'F');
-        SCHED_FN_VOID(dump_runq_el, p);
+        SCHED_FN(dump_runq_el, p);
         printk("c=0x%X%08X\n", (u32)(p->cpu_time>>32), (u32)p->cpu_time);
         printk("         l: %lx n: %lx  p: %lx\n",
                (unsigned long)list, (unsigned long)list->next,
@@ -682,12 +672,12 @@ void dump_runq(u_char key, void *dev_id, struct pt_regs *regs)
     int i;
 
        printk("Scheduler: %s (%s)\n", ops.name, ops.opt_name);
-    SCHED_FN_VOID(dump_settings);
+    SCHED_FN(dump_settings);
     printk("NOW=0x%08X%08X\n",  (u32)(now>>32), (u32)now); 
     for (i = 0; i < smp_num_cpus; i++) {
         spin_lock_irqsave(&schedule_lock[i], flags);
         printk("CPU[%02d] ", i);
-        SCHED_FN_VOID(dump_cpu_state,i);
+        SCHED_FN(dump_cpu_state,i);
         dump_rqueue(&schedule_data[i].runqueue, "rq"); 
         spin_unlock_irqrestore(&schedule_lock[i], flags);
     }
index d06a9f641aa6802d05af30047f2f7f3b6896936b..8574f02531ff713828d080f797142428cae0621e 100644 (file)
@@ -11,7 +11,7 @@
 #define __DOM0_OPS_H__
 
 #include "hypervisor-if.h"
-#include "sched-ctl.h"
+#include "sched_ctl.h"
 
 /*
  * Make sure you increment the interface version whenever you modify this file!
diff --git a/xen/include/hypervisor-ifs/sched-ctl.h b/xen/include/hypervisor-ifs/sched-ctl.h
deleted file mode 100644 (file)
index bb04499..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Generic scheduler control interface.
- *
- * Mark Williamson, (C) 2004 Intel Research Cambridge
- */
-
-#ifndef _SCHED_CTL_H_
-#define _SCHED_CTL_H_
-
-/**
- * When this file is changed, increment the version number.  This ensures that
- * tools will refuse to work (rather than causing a crash) when they're
- * out-of-sync with the Xen version number.
- */
-#define SCHED_CTL_IF_VER 0x0001
-
-/* scheduler types */
-#define SCHED_BVT      0
-#define SCHED_ATROPOS  1
-#define SCHED_RROBIN   2
-
-/* generic scheduler control command - union of all scheduler control
- * command structures */
-struct sched_ctl_cmd
-{
-    unsigned int if_ver;
-    unsigned int sched_id;
-    
-    union
-    {
-        struct bvt_ctl
-        {
-            /* IN variables. */
-            unsigned long ctx_allow;  /* context switch allowance */
-        } bvt;
-
-        struct rrobin_ctl
-        {
-            /* IN variables */
-            u64 slice;                /* round robin time slice */
-        } rrobin;
-    } u;
-};
-
-struct sched_adjdom_cmd
-{
-    unsigned int if_ver;
-    unsigned int sched_id;
-    domid_t domain;
-    
-    union
-    {
-        struct bvt_adjdom
-        {
-            unsigned long mcu_adv;    /* mcu advance: inverse of weight */
-            unsigned long warp;       /* time warp */
-            unsigned long warpl;      /* warp limit */
-            unsigned long warpu;      /* unwarp time requirement */
-        } bvt;
-
-        struct atropos_adjdom
-        {
-            int xtratime;
-        } atropos;
-    } u;
-};
-
-#endif /* _SCHED_CTL_H_ */
diff --git a/xen/include/hypervisor-ifs/sched_ctl.h b/xen/include/hypervisor-ifs/sched_ctl.h
new file mode 100644 (file)
index 0000000..bd9e9d0
--- /dev/null
@@ -0,0 +1,61 @@
+/**
+ * Generic scheduler control interface.
+ *
+ * Mark Williamson, (C) 2004 Intel Research Cambridge
+ */
+
+#ifndef __SCHED_CTL_H__
+#define __SCHED_CTL_H__
+
+/* Scheduler types. */
+#define SCHED_BVT      0
+#define SCHED_ATROPOS  1
+#define SCHED_RROBIN   2
+
+/*
+ * Generic scheduler control command: union of all scheduler control command
+ * structures.
+ */
+struct sched_ctl_cmd
+{
+    unsigned int sched_id;
+    
+    union
+    {
+        struct bvt_ctl
+        {
+            /* IN variables. */
+            unsigned long ctx_allow;  /* context switch allowance */
+        } bvt;
+
+        struct rrobin_ctl
+        {
+            /* IN variables */
+            u64 slice;                /* round robin time slice */
+        } rrobin;
+    } u;
+};
+
+struct sched_adjdom_cmd
+{
+    unsigned int sched_id;
+    domid_t domain;
+    
+    union
+    {
+        struct bvt_adjdom
+        {
+            unsigned long mcu_adv;    /* mcu advance: inverse of weight */
+            unsigned long warp;       /* time warp */
+            unsigned long warpl;      /* warp limit */
+            unsigned long warpu;      /* unwarp time requirement */
+        } bvt;
+
+        struct atropos_adjdom
+        {
+            int xtratime;
+        } atropos;
+    } u;
+};
+
+#endif /* __SCHED_CTL_H__ */